<?php
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/customer_enquiry.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_page.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_table_jui.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/datatables/demo_table.css');
echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/ui-darkness/jquery-ui-1.8.16.custom.css');
echo $this->headScript()->appendFile($this->baseUrl().'/js/jquery-1.6.2.min.js');
echo $this->headScript()->appendFile($this->baseUrl().'/js/jquery-ui-1.8.16.custom.min.js');
echo $this->headScript()->appendFile($this->baseUrl().'/js/datatables/jquery.dataTables.min.js');
?>
<script type="text/javascript">
$(document).ready(function(){
	$('#table').dataTable( {
		"bJQueryUI": true
	});
});

$(function() {
	$("#dialog:ui-dialog").dialog("destroy");
	$("#dialog-confirm").dialog({
		resizable: false,
		modal: true,
	//	autoOpen: false,
		show: "blind",
		hide: "explode",
		buttons: {
			OK: function() {
				$(this).dialog("close");
			}
		}
	});
});
</script>
<?php
$this->title = "Customer Enquiry";
$this->headTitle($this->title);
?>
<h1><a href="<?php echo $this->url(array('controller'=>'index', 'action'=>'index'), null, true); ?>">Home</a> > <?php echo $this->escape($this->title); ?></h1>
<div class="cont">
<?php echo $this->form; ?>
<div class="gap"></div>
<div class="table">
<table id="table">
<thead>
<tr>
	<th>Customer No</th>
	<th>First Name</th>
	<th>Last Name</th>
	<th>Suburb</th>
	<th>Post Code</th>
	<th>Home Phone</th>
	<th>Work Phone</th>
	<th>Mobile Phone</th>
	<th>Pay Method</th>
	<th></th>
	<th>Catalogue</th>
</tr>
</thead>
<tbody>
<?php foreach($this->customers as $customer) { 
		$catalogue = $customer->cust_catalogue
		?>
<tr>
	<td><a href="<?php echo $this->url(array('controller'=>'order', 'action'=>'cart', 'cust_no'=>$customer->cust_no), null, true); ?>"><?php echo $this->escape($customer->cust_no); ?></a></td>
	<td><?php echo $this->escape($customer->cust_first_name); ?></td>
	<td><?php echo $this->escape($customer->cust_last_name); ?></td>
	<td><?php echo $this->escape($customer->cust_suburb); ?></td>
	<td><?php echo $this->escape($customer->cust_post_code); ?></td>
	<td><?php echo $this->escape($customer->cust_home_phone); ?></td>
	<td><?php echo $this->escape($customer->cust_work_phone); ?></td>
	<td><?php echo $this->escape($customer->cust_mobile_phone); ?></td>
	<td><?php echo $this->escape($customer->cust_pay_method); ?></td>
	<td><a href="<?php echo $this->url(array('controller'=>'customer', 'action'=>'edit', 'cust_no'=>$customer->cust_no), null, true); ?>">Edit</a></td>
	<?php if($catalogue == 0) {	?>
	<td>Non-apply</td>
	<?php }	else { ?>
	<td><?php echo $catalogue; ?></td>
	<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php if (count($this->customers) == 0) { ?>
<div id="dialog-confirm" title="ERROR">
<p>No matching data!</p>
</div>
<?php } ?>